﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class product_listing_details : SitePublicBasePage
{
    public String ProductPath
    {
        get
        {
            try
            {
                return Page.RouteData.Values["path"].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadControlState();
        }
    }
    private void LoadControlState()
    {
        if (!string.IsNullOrEmpty(ProductPath))
        {
            if (!ProductPath.EndsWith(".axd"))
            {
                if (ProductPath.ToLower() != "default.aspx" && ProductPath.EndsWith(".aspx"))
                {
                    wucProduct.BindDetails();
                    wucProduct.Visible = true;
                    ProductListing1.Visible = false;
                }
                else if (ProductPath.ToLower() != "default.aspx" && !ProductPath.EndsWith(".aspx"))
                {
                    wucProduct.Visible = false;
                    ProductListing1.Visible = true;
                    ProductListing1.LoadListing(ProductPath);
                }
            }
        }
    }
}